<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport"
        content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta content="telephone=no" name="format-detection" />
    <!-- 留作将来统一添加 -->
    <TEMPLATE>${TEMPLATE}</TEMPLATE>
    <title>模板html</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css">
    <link rel="stylesheet" type="text/css" href="../../css/index.css">
    <link rel="stylesheet" type="text/css" href="../../css/data-flex.min.css">
    <style type="text/css">
        body {
            background: rgba(90, 194, 255, 1);
        }

        .container {
            margin: 15px;
            padding: 0 15px;
            background: rgba(255, 255, 255, 1);
            box-shadow: 0px 4px 10px 0px rgba(0, 135, 214, 0.37);
            border-radius: 8px;
        }

        .head {
            height: 44px;
        }

        .head-title {
            font-size: 15px;
            font-weight: 400;
            color: rgba(25, 25, 25, 1);
        }

        .head-img {
            width: 15px;
            height: 15px;
        }

        .bor {
            height: 1px;
            background: rgb(212, 212, 212);
            transform: translateY(0.5);
        }

        .body {
            padding: 19px 0 15px 0;
        }

        .body-row {
            margin-top: 12px;
        }

        .body-row:first-child {
            margin-top: 0;
        }

        .body-key {
            font-size: 14px;
            font-weight: 400;
            color: rgba(128, 128, 128, 1);
        }

        .body-value {
            font-size: 14px;
            font-weight: 400;
            color: rgba(25, 25, 25, 1);
        }
    </style>
</head>

<body>
    <div class="vueApp" v-cloak>
        <div class="container" @click="editBankCard()">
            <div class="head" data-flex="main:justify cross:center">
                <div class="head-title">
                    银行卡
                </div>
                <div class="head-img">
                    <img src="../../image/ui/edit.png" alt="">
                </div>
            </div>
            <div class="bor"></div>
            <div class="body">
                <div class="body-row" data-flex="main:justify cross:center">
                    <div class="body-key">
                        持卡人:
                    </div>
                    <div class="body-value">
                        {{ bank.cardHolder }}
                    </div>
                </div>
                <div class="body-row" data-flex="main:justify cross:center">
                    <div class="body-key">
                        开户行:
                    </div>
                    <div class="body-value">
                        {{ bank.bankName }}
                    </div>
                </div>
                <div class="body-row" data-flex="main:justify cross:center">
                    <div class="body-key">
                        银行卡号:
                    </div>
                    <div class="body-value">
                        {{ bank.bankNo }}
                    </div>
                </div>
            </div>
        </div>
        <div class="container" @click="editAlipay()">
            <div class="head" data-flex="main:justify cross:center">
                <div class="head-title">
                    支付宝
                </div>
                <div class="head-img">
                    <img src="../../image/ui/edit.png" alt="">
                </div>
            </div>
            <div class="bor"></div>
            <div class="body">
                <div class="body-row" data-flex="main:justify cross:center">
                    <div class="body-key">
                        姓名:
                    </div>
                    <div class="body-value">
                        {{ alipay.userName }}
                    </div>
                </div>
                <div class="body-row" data-flex="main:justify cross:center">
                    <div class="body-key">
                        账户绑定手机号:
                    </div>
                    <div class="body-value">
                        {{ alipay.phone }}
                    </div>
                </div>
                <div class="body-row" data-flex="main:justify cross:center">
                    <div class="body-key">
                        支付宝账号:
                    </div>
                    <div class="body-value">
                        {{ alipay.alipayAccount }}
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/service/service-tool.js"></script>
<script type="text/javascript" src="../../script/service/service-app.js"></script>
<script type="text/javascript" src="../../script/service/service-user.js"></script>
<script type="text/javascript" src="../../script/service/service-logic.js"></script>
<script type="text/javascript" src="../../script/jquery.min.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript">
    // html 的引号一律为双引号(""),js 为单引号('')
    var USER, $S, vm;
    apiready = function () {
        $S = SERVICE();
        USER = USER();
        console.log(JSON.stringify(api.pageParam) + '=====pageParam');
        fnInit();
    };
    // 初始化
    function fnInit() {
        vm = new Vue({
            el: '.vueApp',
            data: {
                bank: {},
                alipay: {}
            }
        });
        getPageData();
    }

    function getPageData() {
        var params = {
            'entityName': 'withDrawAccount'
        };
        var url = 'common/findList';
        var callback = function (data) {
            for(var i = 0; i < data.listData.length; i ++) {
                var item = data.listData[i];
                if(item.bankNo !== '') {
                    vm.bank = item;
                } else {
                    vm.alipay = item;
                }
            }
        };
        POST(url, params, callback);
    }

    // 编辑银行卡
    function editBankCard() {
        fnOpenPublicWin('编辑银行卡', 'teacher/bind_bank', {
            id: vm.bank.id,
            winName: api.winName,
            frmName: api.frameName,
            cardHolder: vm.bank.cardHolder,
            bankName: vm.bank.bankName,
            bankNo: vm.bank.bankNo,
            openingBank: vm.bank.openingBank
        });
    }

    // 编辑支付宝
    function editAlipay() {
        fnOpenPublicWin('编辑支付宝', 'teacher/bind_alipay', {
            id: vm.alipay.id,
            winName: api.winName,
            frmName: api.frameName,
            userName: vm.alipay.userName,
            phone: vm.alipay.phone,
            alipayAccount: vm.alipay.alipayAccount
        });
    }
</script>

</html>